//
//  HYCPushDisDetailsController.m
//  FamilyTravel
//
//  Created by dllo on 15/10/24.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCPushDisDetailsController.h"
#import "UMSocialSnsService.h"
#import "UMSocial.h"
#import "HYCHeadDocument.h"
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

@interface HYCPushDisDetailsController ()<UIWebViewDelegate,UMSocialUIDelegate>
@property(nonatomic, retain) MBProgressHUD *hud;
@end

@implementation HYCPushDisDetailsController
{
    UIActivityIndicatorView *acView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    [self.view addSubview:webView];
    webView.delegate = self;
    webView.scalesPageToFit = YES;
    
    acView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 32.0, 32.0)];
    acView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    acView.center = self.view.center;
    NSURL *url = [NSURL URLWithString:self.wStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
    webView.delegate = self;
    
    
    self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    self.hud.labelText = @"飞速加载中";
    
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 20, 18);
    [button setBackgroundImage:[UIImage imageNamed:@"share.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    
    
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
    [self.hud removeFromSuperview];
}



- (void)buttonAction:(UIButton *)button{
    
    [UMSocialSnsService presentSnsIconSheetView:self
                                         appKey:@"5639b440e0f55aa58000115b"
                                      shareText:self.wStr
                                     shareImage:[UIImage imageNamed:@"icon  "]
                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToTencent,UMShareToRenren,nil]
                                       delegate:self];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
